<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta content="width=device-width,initial-scale=1.0, user-scalable=no" name="viewport"/>
    <meta content="yes" name=" apple-mobile-web-app-capable"/>
    <meta content="no" name="apple-touch-fullscreen"/>
    <meta content="black" name=" apple-mobile-web-app-status-bar-style"/>
    <meta content="telephone=no" name="format-detection"/>
    <link rel="stylesheet" href="css/reset.css" />
    <link rel="stylesheet" href="font/iconfont.css">
    <link rel="stylesheet" href="css/style.css" />
    <script src="js/jquery-1.11.3.min.js" type="text/javascript"></script>
    <title>意见反馈</title>
    <style>
        .layui-m-layercont{
            padding: 30px!important;
            text-align: left!important;
            font-size: 15px!important;
        }

    </style>
</head>
<body>
<!--头部-->
<div class="daohanglan_box">
    <div class="title">
        <i class="icon iconfont icon-iconfontjiantou1"></i>
        <h4>意见反馈</h4>
    </div>
</div>
<div class="formBox">
    <form>
        <input placeholder="你的主题：" type="text" class="subject"/>
        <textarea placeholder="请在这里写下你的宝贵意见或建议..." class="content"></textarea>
        <p>（*∩_∩*）′详细描述你的问题，有助于我们快速帮你解决问题或留下你的宝贝建议，我们会认真进行评估！</p>
        <input placeholder="手机号或邮箱 ( 必填 )" type="text" class="phone">
        <button type="button" class="submitBtn">提交</button>
    </form>
</div>
<script src="js/layer.js" type="text/javascript"></script>
<script type="text/javascript" src="js/main.js"></script>
<script>
    $(function(){
        //提交
        $(".formBox").on("click",".submitBtn",function(){
            var subject = $(".subject").val();
            var content = $(".content").val();
            var phone = $(".phone").val();
            var nub = /^\w+$/;
            var reg=/^1[3|4|5|7|8|9][0-9]\d{4,8}$/;
            var regEmail=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
            if(subject == ""){
                error("请填写主题");
            }else if(content == ""){
                error("请填写您的意见");
            }else if(phone == ""){
                error("请填写手机号或邮箱")
            } else if( !isNaN( phone ) ) {
               if(!reg.test(phone)){
                   error("请填写手机号或邮箱");
               }
               else{
                   layer.open({
                       shadeClose: false,
                       content: '\<\div id="formTip" class="clearfix">' +
                       '<p>提交成功,感谢你的建议，我们会认真 </p>' +
                       '<p>评估，持续为你改进</p>' +
                       '<button type="button">确定</button>'+
                       '\<\/div>'
                   });
                   return false;
               }
            } else if(!regEmail.test(phone)){
                error("请填写正确的邮箱");
                return false;
            } else{
                layer.open({
                    shadeClose: false,
                    content: '\<\div id="formTip" class="clearfix">' +
                    '<p>提交成功,感谢你的建议，我们会认真 </p>' +
                    '<p>评估，持续为你改进</p>' +
                    '<button type="button">确定</button>'+
                    '\<\/div>'
                });
            }
        });
        //关闭弹窗
        $("body").on("click","#formTip button",function(){
            layer.closeAll();
            location.reload();

        })
    })
</script>
</body>
</html>